package com.qdu.controller;

import com.qdu.entity.Orderinfo;
import com.qdu.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/delete")
    public void deleteByPrimaryKey(String oid){
        orderService.deleteByPrimaryKey(oid);
    }

    @PostMapping("/add")
    public void insert(Orderinfo record){
        orderService.insert(record);
    }

    @PostMapping("/addselective")
    public void insertSelective(Orderinfo record){
        orderService.insertSelective(record);
    }

    @GetMapping("getbyoid")
    public Orderinfo selectByPrimaryKey(String oid){
        return orderService.selectByPrimaryKey(oid);
    }

    @GetMapping("/addbyuid")
    public List<Orderinfo> selectByUid(String uid){
        return orderService.selectByUid(uid);
    }

    @PostMapping("/addbyhid")
    public List<Orderinfo> selectByHid(String hid){
        return orderService.selectByHid(hid);
    }

    @PostMapping("/updateselective")
    public void updateByPrimaryKeySelective(Orderinfo record){
        orderService.updateByPrimaryKeySelective(record);
    }

    @PostMapping("/update")
    public void updateByPrimaryKey(Orderinfo record){
        orderService.updateByPrimaryKey(record);
    }
}
